<?php
function recieveMessages($id,$connection){
	$query = "CALL getMessages('".$id."')";
	$result = mysqli_query($conection,$query);
	$tdata = array("from_id"=>"","req_id"=>"","time_stamp"=>"","content"=>"");
	$data = array($tdata);
	$i=0;
	while($temp = mysqli_fetch_array($result,MYSQLI_ASSOC)){
		$tdata['from_id']=$temp['from_id'];
		$tdata['req_id']=$temp['req_id'];
		$tdata['time_stamp']=$temp['time_stamp'];
		$tdata['content']=$temp['content'];
		$data[$i]=$tdata;
		$i++;
	}
	mysqli_free_result($result);
	return $data;
}
function sendMessage($from_id,$to_id,$content,$connection){
	$query = "CALL setMessage('".$from_id."','".$to_id."'".$content."')";
	$result = mysqli_query($connection,$query);
	mysqli_free_result($result);
}
?>